import { faker } from "@faker-js/faker";

/**
 * User permission mock
 */

const MANAGEMENT_PERMISSION = {
  id: "0901673425580518",
  parentId: "",
  label: "sys.menu.management",
  name: "Management",
  icon: "gravity-ui:circle-check-fill",
  route: "management",
  order: 2,
  children: [
    {
      id: "2781684678535711",
      parentId: "0901673425580518",
      label: "sys.menu.user.index",
      name: "User",
      route: "user",
      children: [
        {
          id: "4754063958766648",
          parentId: "2781684678535711",
          label: "sys.menu.user.profile",
          name: "Profile",
          route: "profile",
          component: "/management/user/profile/index.tsx",
        },
        {
          id: "2516598794787938",
          parentId: "2781684678535711",
          label: "sys.menu.user.account",
          name: "Account",
          route: "account",
          component: "/management/user/account/index.tsx",
        },
      ],
    },
    {
      id: "0249937641030250",
      parentId: "0901673425580518",
      label: "sys.menu.system.index",
      name: "System",
      route: "system",
      children: [
        {
          id: "1985890042972842",
          parentId: "0249937641030250",
          label: "sys.menu.system.organization",
          name: "Organization",
          route: "organization",
          component: "/management/system/organization/index.tsx",
        },
        {
          id: "4359580910369984",
          parentId: "0249937641030250",
          label: "sys.menu.system.permission",
          name: "Permission",
          route: "permission",
          component: "/management/system/permission/index.tsx",
        },
        {
          id: "1689241785490759",
          parentId: "0249937641030250",
          label: "sys.menu.system.role",
          name: "Role",
          route: "role",
          component: "/management/system/role/index.tsx",
        },
        {
          id: "0157880245365433",
          parentId: "0249937641030250",
          label: "sys.menu.system.user",
          name: "User",
          route: "user",
          component: "/management/system/user/index.tsx",
        },
        {
          id: "0157880245365434",
          parentId: "0249937641030250",
          label: "sys.menu.system.user_detail",
          name: "User Detail",
          route: "user/:id",
          component: "/management/system/user/detail.tsx",
          hide: true,
        },
      ],
    },
  ],
};
const ERRORS_PERMISSION = {
  id: "9406067785553476",
  parentId: "",
  label: "sys.menu.error.index",
  name: "Error",
  icon: "bxs:error-alt",
  route: "error",
  order: 6,
  children: [
    {
      id: "8557056851997154",
      parentId: "9406067785553476",
      label: "sys.menu.error.403",
      name: "403",
      route: "403",
      component: "/sys/error/Page403.tsx",
    },
    {
      id: "5095669208159005",
      parentId: "9406067785553476",
      label: "sys.menu.error.404",
      name: "404",
      route: "404",
      component: "/sys/error/Page404.tsx",
    },
    {
      id: "0225992135973772",
      parentId: "9406067785553476",
      label: "sys.menu.error.500",
      name: "500",
      route: "500",
      component: "/sys/error/Page500.tsx",
    },
  ],
};
const OTHERS_PERMISSION = [
  {
    id: "5733704222120995",
    parentId: "",
    label: "sys.menu.frame",
    name: "Frame",
    icon: "gravity-ui:thumbs-up-fill",
    route: "frame",
    children: [
      {
        id: "9884486809510480",
        parentId: "5733704222120995",
        label: "sys.menu.external_link",
        name: "External Link",
        route: "external_link",
        hideTab: true,
        component: "/Iframe/ExternalLink.tsx",
        frameSrc: "https://ant.design/",
      },
      {
        id: "9299640886731819",
        parentId: "5733704222120995",
        label: "sys.menu.iframe",
        name: "Iframe",
        route: "iframe",
        component: "/Iframe/index.tsx",
        frameSrc: "https://www.typescriptlang.org/",
      },
    ],
  },
];
export const DEFAULT_PERMISSION_LIST = [
  MANAGEMENT_PERMISSION,
  ERRORS_PERMISSION,
  ...OTHERS_PERMISSION,
];
export const TEST_PERMISSION_LIST = [...OTHERS_PERMISSION];

/**
 * User data mock
 */
export const DEFAULT_USER = {
  id: "b34719e1-ce46-457e-9575-99505ecee828",
  username: "admin",
  email: faker.internet.email(),
  avatar: faker.image.avatarGitHub(),
  createdAt: faker.date.anytime(),
  updatedAt: faker.date.recent(),
  password: "123456",
  permissions: DEFAULT_PERMISSION_LIST,
};
export const TEST_USER = {
  id: "efaa20ea-4dc5-47ee-a200-8a899be29494",
  username: "test",
  password: "123456",
  email: faker.internet.email(),
  avatar: faker.image.avatarGitHub(),
  createdAt: faker.date.anytime(),
  updatedAt: faker.date.recent(),
  permissions: TEST_PERMISSION_LIST,
};
export const USER_LIST = [DEFAULT_USER, TEST_USER];
